package com.sm.dao;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.sm.util.IPage;

public interface BaseDAO {

	public Serializable save(Object o);

	public void delete(Object o);

	public void update(Object o);

	public void saveOrUpdate(Object o);
	
	public <T> List<T> getAll(Class<T> cla);

	public <T> List<T> find(String hql, Object... param);

	public <T> List<T> findCache(String hql, Object... param);

	public <T, K> List<T> find(String hql, Map<String, List<K>> map, Object... param);
	
	public <T, K> List<T> findByPage(String hql, Map<String, List<K>> map, IPage page, Object... param);

	public <T> List<T> findByPage(String hql, IPage page, Object... param);

	public <T> T get(Class<T> c, Serializable id);

	public <T> T load(Class<T> c, Serializable id);

	public <T> T getOne(String hql, Object... param);

	public Long count(String hql, Object... param);

	public <T> Long count(String hql, Map<String, List<T>> map, Object... param);
	
	public Integer executeHql(String hql, Object... param);

	public <T> void batchAddEnity(final List<T> list) throws Exception;

	public <T> void batchDeleteEnity(final List<T> list) throws Exception;

	public <T> void batchSaveEnity(final Set<T> list) throws Exception;

	public <T> Integer executeHql(String hql, Map<String, List<T>> map, Object... param);
	
	public <T, K> List<T> findByPageAndSql(String sql, Class<T> cls, Map<String, List<K>> map, IPage page, Object... param);
	
	public <T, K> List<T> findByPageAndSql(String sql, Class<T> cls, IPage page, Object... param);
	
	public <T> Long countSql(String sql, Map<String, List<T>> map, Object... param);
	
	public <T> Long countSql(String sql, Object... param);
	
	public void delete(Class<?> cla, Long... ids);
}
